<template>
	<view class="mySy">
		<view class="syBox">
			<view class="syitem">
				<view class="">
					<text style="font-size: 20rpx;">￥</text><text style="font-size: 38rpx;">{{today_profit}}</text>
				</view>
				<view class="" style="font-size: 28rpx;">
					今日收益
				</view>
			</view>
			<view class="shu"></view>
			<view class="syitem">
				<view class="">
					<text style="font-size: 20rpx;">￥</text><text style="font-size: 38rpx;">{{all_profit}}</text>
				</view>
				<view class="" style="font-size: 28rpx;">
					累计收益
				</view>
			</view>
		</view>

		<view class="title">
			收益明细
		</view>
		<view v-if="dataList.length" class="dataList">
			<view class="listitem" v-for="(item,index) in dataList">
				<view class="left">
					{{item.pay_time}}
				</view>
				<view class="right">
					+￥{{item.fee2}}
				</view>

			</view>

		</view>
		<view v-else class="">
			<u-empty mode="data" text="暂无收益">
			</u-empty>
		</view>


	</view>
</template>

<script>
	import {
		userprofit1,
		userprofit2
	} from "@/api/api.js"
	export default {
		data() {
			return {
				all_profit: "",
				today_profit: "",
				dataList: [],
			}
		},
		onLoad() {
			if (!uni.getStorageSync("token")) {
				uni.reLaunch({
					url: "../login/index"
				})
				return
			}
			this.handleUserprofit1()
			this.handleuserprofit2()
		},
		methods: {
			async handleUserprofit1() {
				let res = await userprofit1()
				// console.log("收益总", res)
				this.today_profit = res.data.today_profit
				this.all_profit = res.data.all_profit
			},
			async handleuserprofit2() {
				let res = await userprofit2()
				console.log("收益列表", res)
				this.dataList = res.data.data
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		width: 100%;
		min-height: 100%;
		background-color: #ffffff;

	}

	.mySy {
		padding: 30rpx;
		box-sizing: border-box;

		.syBox {
			width: 100%;
			height: 270rpx;
			background-color: #359691;
			border-radius: 20rpx;
			display: flex;
			color: #ffffff;

			.syitem {
				width: 50%;
				text-align: center;
				padding-top: 90rpx;
				box-sizing: border-box;
			}

			.shu {
				width: 1rpx;
				height: 150rpx;
				background-color: #F4F4F4;
				margin-top: 60rpx;
			}
		}

		.title {
			margin-top: 20rpx;
		}

		.dataList {
			margin-top: 20rpx;
			width: 100%;
			box-sizing: border-box;

			.listitem {
				height: 80rpx;
				display: flex;
				justify-content: space-between;
				line-height: 80rpx;
				color: #333333;
				border-bottom: 1rpx solid #F4F4F4;
			}

			.listitem:last-child {
				border-bottom: none;
			}
		}
	}
</style>